package com.sunnyint.orderprinter.api;

/**
 * 返回
 * @param <T>
 */
public class ApiResult <T>{
    private int code;
    private String msg;
    private T data;

    public ApiResult(){}

    public ApiResult(int code, String msg, T data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ApiResult ok(){
        return new ApiResult(200, "success", "");
    }

    public static <T> ApiResult fail(T data){
        return new ApiResult(500, "请求失败", data);
    }
}
